package com.iot.messaage;

import com.iot.network.DeviceSession;

/**
 * @author Administrator
 */
public interface FromDeviceMessageContext {
    DeviceSession getSession();

    static FromDeviceMessageContext of(final DeviceSession session, final EncodedMessage message) {
        return new FromDeviceMessageContext() {
            @Override
            public DeviceSession getSession() {
                return session;
            }

            public EncodedMessage getMessage() {
                return message;
            }
        };
    }

    static FromDeviceMessageContext of(final DeviceSession session) {
        return new FromDeviceMessageContext() {
            @Override
            public DeviceSession getSession() {
                return session;
            }
        };
    }
}
